<template>
  <div>
    <div class="header">
      <div>
        <i class="svg-icon icon-back" @click="back()"></i>
        <h2>个人中心</h2>
      </div>
    </div>
    <div class="contain">
      <div class="phone">
        <p>{{ userInfo.username ? userInfo.username : "个人账号" }}</p>
        <i class="svg-icon icon-back"></i>
      </div>
      <div class="myorder">
        <h2>我的订单</h2>
        <div class="main">
          <div class="left">
            <i class="ordericon orderall"></i>
            <span>全部订单</span>
          </div>
          <div class="center">
            <i class="ordericon orderpay"></i>
            <span>待支付</span>
          </div>
          <div class="right">
            <i class="ordericon orderget"></i>
            <span>待收货</span>
          </div>
        </div>
      </div>
      <div class="promise">
        <p>您尚未申请免保证金额度</p>
        <div class="pbottom">
          <p>可用于下单时抵扣设备保证金</p>
          <a href="">
            <span>开通</span>
          </a>
        </div>
      </div>
      <div class="account-box">
        <div class="one">
          <div class="con">
            <div class="left">
              <span
                >账户余额
                <p>(元)</p></span
              >
              <b>充值</b>
            </div>
            <div class="right">
              <span>0.00</span>
            </div>
          </div>
        </div>
        <div class="two">
          <div class="box">
            <div class="left">
              <span
                >优惠券
                <p>(张)</p></span
              >
            </div>
            <div class="right">
              <span>0</span>
            </div>
          </div>
        </div>
        <div class="two">
          <div class="box">
            <div class="left">
              <span
                >我的账单
                <p>(元)</p></span
              >
            </div>
            <div class="right">
              <span>0.00</span>
            </div>
          </div>
        </div>
        <div class="two">
          <div class="box">
            <div class="left">
              <span
                >我的设备
                <p>(台)</p></span
              >
            </div>
            <div class="right">
              <span>0</span>
            </div>
          </div>
        </div>
      </div>
      <div class="else">
        <h2>其他服务</h2>
        <div class="main">
          <div class="left">
            <router-link to="/personal/address">
              <i class="ordericon orderall"></i>
              <span>收货地址</span>
            </router-link>
          </div>
          <div class="center">
            <i class="ordericon orderpay"></i>
            <span>人工服务</span>
          </div>
          <div class="right">
            <i class=""></i>
          </div>
        </div>
      </div>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
import {mapState} from 'vuex'
export default {
  computed: {
    ...mapState({
      userInfo:state=>state.user.userInfo
    }),
  },
  methods: {
    back() {
      history.back()
    }
  },
}
</script>

<style lang="scss" scoped>
.header {
  position: flex;
  top: 0;
  left: 0;
  width: 100%;
  height: 36px;
  color: #000;
  box-sizing: border-box;
  z-index: 99;
  border-bottom: 1px solid #ccc;
  background: #fff;
  text-align: center;
  line-height: 34px;

  h2 {
    font-size: 17.5px;
    font-weight: 700;
  }
  .svg-icon {
    display: inline-block;
    width: 25px;
    height: 25px;
    background-size: cover;
    background-position: 50%;
    background-repeat: no-repeat;
  }

  .icon-back {
    position: absolute;
    top: 5px;
    left: 10px;
    background-image: url();
  }
}
.contain {
  position: absolute;
  top: 36px;
  right: 0;
  left: 0;
  bottom: 50px;
  overflow-x: hidden;
  overflow-y: auto;
  //   background: #fff;
  .phone {
    height: 70px;
    line-height: 70px;
    background: #fff;
    p {
      font-size: 16px;
      font-weight: 700;
      color: #666d67;
      float: left;
      padding-left: 20px;
    }
    .svg-icon {
      display: inline-block;
      width: 25px;
      height: 25px;
      background-size: cover;
      background-position: 50%;
      background-repeat: no-repeat;
    }
    .icon-back {
      position: absolute;
      top: 25px;
      right: 10px;
      background-image: url();
    }
  }
  .myorder,
  .else {
    height: 155px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    margin-top: 10px;
    background: #fff;
    h2 {
      height: 51px;
      font-size: 14px;
      color: #000;
      font-weight: 700;
      padding-left: 20px;
      line-height: 51px;
    }
    .main {
      width: 100%;
      height: 90px;
      display: flex;
      justify-content: space-around;
      align-items: flex-end;
      margin-top: -20px;
      .ordericon {
        display: block;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-size: contain;
      }
      span {
        font-size: 12px;
        font-weight: 700;
        color: #333;
      }
      .left {
        width: 76px;
        height: 70px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .orderall {
          background: 50% no-repeat
            url();
        }
      }
      .center {
        width: 76px;
        height: 70px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .orderpay {
          width: 46px;
          height: 46px;
          background: 50% no-repeat
            url();
        }
      }
      .right {
        width: 76px;
        height: 70px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        .orderget {
          width: 46px;
          height: 46px;
          background: 50% no-repeat
            url();
        }
      }
    }
  }
  .else {
    .orderall {
      width: 46px;
      height: 46px;
      background: 50% no-repeat
        url();
    }
    .orderpay {
      width: 46px;
      height: 46px;
      background: 50% no-repeat
        url();
    }
  }
  .promise {
    width: 100%;
    height: 104px;
    display: flex;
    flex-direction: column;
    background: #fff;
    justify-content: center;
    margin-top: 10px;
    p {
      height: 46px;
      font-size: 14px;
      font-weight: 700;
      color: #333;
      padding-left: 20px;
      float: left;
      line-height: 46px;
    }
    .pbottom {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      p {
        font-size: 14px;
        color: #999;
      }
      span {
        display: inline-block;
        width: 58px;
        height: 22px;
        border: 1px solid #37a3ff;
        color: #37a3ff;
        background-color: #fff;
        font-size: 12px;
        border-radius: 11px;
        text-align: center;
        line-height: 22px;
        margin-right: 20px;
      }
    }
  }
  .account-box {
    width: 100%;
    height: 211px;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-top: 10px;
    .one {
      width: 100%;
      height: 25%;
      border-bottom: 1px solid #ccc;
      display: flex;
      justify-content: center;
      align-items: center;
      .con {
        width: 90%;
        height: 53px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .left {
          width: 180px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          span {
            font-weight: 700;
            font-size: 14px;
            color: #000;
            display: flex;
          }
          p {
            font-size: 12px;
            color: #999;
            padding-left: 10px;
          }
          b {
            display: inline-block;
            width: 58px;
            height: 22px;
            border: 1px solid #37a3ff;
            color: #37a3ff;
            background-color: #fff;
            font-size: 12px;
            border-radius: 11px;
            text-align: center;
            line-height: 22px;
            margin-right: 20px;
          }
        }
        .right {
          font-size: 14px;
          color: #666d67;
        }
      }
    }
    .two {
      width: 100%;
      height: 25%;
      border-bottom: 1px solid #ccc;
      display: flex;
      justify-content: center;
      align-items: center;
      .box {
        width: 90%;
        height: 53px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .left {
          width: 100px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          span {
            display: inline-block;
            font-size: 14px;
            font-weight: 700;
            color: #000;
            display: flex;
          }
          p {
            font-size: 12px;
            color: #999;
            padding-left: 10px;
          }
        }
        .right {
          font-size: 14px;
          color: #666d67;
        }
      }
    }
  }
}
</style>